package com.xpffly.design.factory.simple;

import com.xpffly.design.factory.base.service.Human;
import com.xpffly.design.factory.base.service.impl.BlackHuman;
import com.xpffly.design.factory.base.service.impl.WhiteHuman;
import com.xpffly.design.factory.base.service.impl.YellowHuman;
import com.xpffly.design.factory.simple.factory.HumanFactory;

/**
 * @Author: xpengfei
 * @Date: 2021/3/27 19:08
 * @Description：简单工厂模式中的场景类
 */
public class NvWa {
    public static void main(String[] args) {
        Human whiteHuman = HumanFactory.createHuman(WhiteHuman.class);
        whiteHuman.getColor();
        whiteHuman.talk();
        System.out.println("------------------------------------");
        Human blackHuman = HumanFactory.createHuman(BlackHuman.class);
        blackHuman.getColor();
        blackHuman.talk();
        System.out.println("------------------------------------");
        Human yellowHuman = HumanFactory.createHuman(YellowHuman.class);
        yellowHuman.getColor();
        yellowHuman.talk();
        System.out.println("------------------------------------");
    }
}
